const App = {
    // mixins: [Query],//配置文件，路径/utils/mixins.js
    data() {
        return {
            Data: [],
            page:{
                SQLSerialNumber: "t_grid_event_log",
                PaginationNumber: 1, //页码
                RowAmount: 10,
                Condition:'',
                ExtensionCondition:''
            },
            Total:0,
            relativePath:'',
        }
    },
    mounted() {
        let ls_URL = window.location.href;
        this.relativePath = ls_URL.substring(
            ls_URL.lastIndexOf("view"),
            ls_URL.length
        );
        this.handleShow(this.page);
    },
    methods: {
        handleSizeChange(newSize) {
            this.page.PageNumber = 1;
            this.page.RowAmount = newSize;
            this.handleShow(this.page);
        },
        handleCurrentChange(newPage) {
            this.page.PageNumber = newPage;
            this.handleShow(this.page);
        },
        handleShow(data) {
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalPaginationQueryBySQLSerialNumber`,
                method: "post",
                data,
                success: (res) => {
                    this.Data = res.Rows;
                    this.Total = res.TotalRows;
                    submitSave({
                        Add: {
                            base_operation_log: [{
                                Operation_Type: '0',
                                Operation_Path: this.relativePath,
                                Operation_Main:JSON.stringify(deepClone({
                                    Data:res.Rows,
                                    Param:data
                                })),
                                Operation_Interface: "generalPaginationQueryBySQLSerialNumber",
                                Operation_IP: getIpAddress()
                            }]    
                        }
                    })
                    // $.ajax({
                    //     headers: requestHeaders("JSON"),
                    //     url: `${mh}/generalBusiness/generalSaveByRequestBody`,
                    //     method: "post",
                    //     data: JSON.stringify({
                    //         Data: {
                    //             Add: {
                    //                 base_operation_log: [{
                    //                     Operation_Type: '0',
                    //                     Operation_Path: this.relativePath,
                    //                     Operation_Main:JSON.stringify(deepClone({
                    //                         Data:res.Rows,
                    //                         Param:data
                    //                     })),
                    //                     Operation_Interface: "generalPaginationQueryBySQLSerialNumber",
                    //                     Operation_IP: getIpAddress()
                    //                 }]    
                    //             }
                    //         },
                    //     }),
                    //     complete: (XMLHttpRequest) => {
                    //         requestPretreatment(XMLHttpRequest)
                    //     }
                    // });
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
            });
        },
        xinwen() {
            window.location.href = '../../news_videos_files/news/add.html?action=Add'
        },
        goBack() {
            window.history.back();
        },
    },
};

const { createApp } = Vue;
const app = createApp(App);
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
const ElMessage = ElementPlus.ElMessage;
app.use(ElementPlus,{locale: zhCn});
app.mount("#app");
